feat(Adapters): Add item context to HTTP errors#2252
Open
marcelklehr wants to merge 11 commits intodevelopfrom
Open
feat(Adapters): Add item context to HTTP errors#2252marcelklehr wants to merge 11 commits intodevelopfrom
marcelklehr wants to merge 11 commits intodevelopfrom
Conversation
and always log response body when HTTP status >= 400 see #2158 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances adapter HTTP error reporting to help diagnose sync failures (notably Karakeep 400 validation errors from #2158) by attaching item context to HttpError and logging response bodies for HTTP status codes ≥ 400.
Changes:
- Extend
HttpErrorto optionally include the related item in the error message. - Thread the current bookmark/folder through adapter request helpers so
HttpErrorcan reference the failing item. - Add response-body logging on HTTP errors in several adapters (browser + native paths).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ui/views/native/Home.vue | Template formatting/self-closing tag adjustment. |
| src/lib/adapters/NextcloudBookmarks.ts | Pass item context into request helpers and log HTTP error response bodies. |
| src/lib/adapters/Linkwarden.ts | Pass item context into request helpers and log HTTP error response bodies. |
| src/lib/adapters/Karakeep.ts | Pass item context into request helpers and log HTTP error response bodies; adjust folder deletion to provide items. |
| src/errors/Error.ts | Extend HttpError to include optional item context in message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/lib/adapters/Karakeep.ts:126
- These resource methods are typed as
Bookmark<TItemLocation>/Folder<TItemLocation>, which is broader than the adapter’s declaredIResource<typeof ItemLocation.SERVER>contract. Narrowing these toBookmark<typeof ItemLocation.SERVER>/Folder<typeof ItemLocation.SERVER>helps prevent accidentally passing local-tree items into server calls and keeps typings consistent across adapters.
async createBookmark(bookmark: Bookmark<TItemLocation>): Promise<string | number> {
Logger.log('(karakeep)CREATE', { bookmark })
const response = await this.sendRequest(
'POST',
'/api/v1/bookmarks',
'application/json',
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
…s not used" This reverts commit 359c618.
…s code Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
and always log response body when HTTP status >= 400
see #2158